<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>您好Springboot</title>
<script src="../js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
$(function(){

<!--方式二-->
$.ajax(){
   url:"/findAjax",
   method:"get",
   params:{id:1,name="tomcat"},
   success:function(data){
   alter("请求成功")
   for(let user in data){
   let name=user.name;
   let id=user.id;
   let age=user.age;
   let sex=user.sex;
   let tr="<tr><td>"+id+"</td><td>"+name+"</td><td>"+age+"</td><td>"+sex"</td><tr>"
   $("#table1").append(tr);
   }

   },
   error:function(data){
   alter("请求失败")
   },
   cache:true,
   async:true

}

<!--方式一
$.get("/findAjax",{id:1},function(data){
     console.log(data)

     for(let user in Data){
         let name=user.name;
          let id=user.id;
          let sex=user.sex;
          let age=user.age;
      let tr="<tr align='center'><td>"+id+"</td><td>"+name+"</td><td>"+age+"</td><td>"+sex+"</td></tr>"
      $("#table").append(tr);
     }


})-->




})





</script>
</head>
<body>
	<table id="table1" border="1px" width="65%" align="center">
		<tr>
			<td colspan="6" align="center"><h3>学生信息</h3></td>
		</tr>
		<tr>
			<th>编号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>性别</th>
			<th></th>
		</tr>

	</table>
</body>
</html>